﻿import QtQuick 2.0
import QtQuick.Shapes 1.0
import QtQuick.Particles 2.0

Item {
    id: root
    width: 300
    height: 300

    Connections{
        target: widget
        onSendKeyPress: {
            //            console.log("====",name)
            //            trailsNormal.enabled = true
        }
        onSendStop: {
            //            trailsNormal.enabled = false
        }
        onSend_mouse_position: {
            //            console.log("====",x,y)
            px = x
            py = y
        }
    }

    property bool displayCanvas: false

    property real px: 0
    property real py: 0
    property real emitRateCount: 150
    property real glifeSpan: 3000
    property alias sys1: sys1


    MyPathAnimL{
        id: myPathAnimL
        dx: px+110
        dy: py
    }

    MyPathAnimZ{
        id: myPathAnimZ
        dx: px+110*2
        dy: py
    }

    MyPathAnimY{
        id: myPathAnimY
        dx: px+110*3
        dy: py
    }

    MyPathAnim5{
        id: myPathAnim5
        dx: px+110*4
        dy: py
    }

    MyPathAnim2{
        id: myPathAnim2
        dx: px+110*5
        dy: py
    }

    MyPathAnim0{
        id: myPathAnim0
        dx: px+110*6
        dy: py
    }

    MyPathAnimC{
        id: myPathAnimC1
        dx: px+110*7
        dy: py
    }

    MyPathAnimC{
        id: myPathAnimC2
        dx: px+110*8
        dy: py
    }


    ParticleSystem { id: sys1 }
    ImageParticle {
        system: sys1
        source: "qrc:/images/image/glowdot.png"
        color: "cyan"
        alpha: 0
        SequentialAnimation on color {
            loops: Animation.Infinite
            ColorAnimation {
                from: "cyan"
                to: "magenta"
                duration: 1000
            }
            ColorAnimation {
                from: "magenta"
                to: "blue"
                duration: 2000
            }
            ColorAnimation {
                from: "blue"
                to: "violet"
                duration: 2000
            }
            ColorAnimation {
                from: "violet"
                to: "cyan"
                duration: 2000
            }
        }
        colorVariation: 0.3
    }

    MyEmitter {
        id: trailsNormal
//        enabled: false
        x: myPathAnimL.targetX
        y: myPathAnimL.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnimZ.targetX
        y: myPathAnimZ.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnimY.targetX
        y: myPathAnimY.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnim5.targetX
        y: myPathAnim5.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnim2.targetX
        y: myPathAnim2.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnim0.targetX
        y: myPathAnim0.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnimC1.targetX
        y: myPathAnimC1.targetY
    }

    MyEmitter {
        enabled: trailsNormal.enabled
        x: myPathAnimC2.targetX
        y: myPathAnimC2.targetY
    }
}
